<?php $this->_extends('../_layouts/default_layout'); ?>
<?php $this->_block('contents'); ?>
<script type="text/javascript" src="<?=Q::ini('custom_system/base_url')?>js/jq.mselect.js?"></script>
<script type="text/javascript">
$(function(){
	$(".datepicker").datepicker({dateFormat:'yy-mm-dd',changeMonth:true});
	var product_categories_data = <?=$product_categories_data?>;
	$(document).mselect(product_categories_data, 'product_categories_id', 'product_categories_id', "<?=(isset($_GET['product_categories_id']))?$_GET['product_categories_id']:0?>");
});
</script>

<fieldset><legend>查询条件</legend>
<form method="get">
<? include(Q::ini('custom_system/elements_dir') . 'searchform_element.php');?>
<table class="form_table">
<tr>
	<th>日期</th>
	<td>
		<input type="text" class="datepicker" name="begin" value="<?=isset($_GET['begin'])?$_GET['begin']:date('Y-m-01', CURRENT_TIMESTAMP)?>" /> to 
		<input type="text" class="datepicker" name="end" value="<?=isset($_GET['end'])?$_GET['end']:date('Y-m-t', CURRENT_TIMESTAMP)?>" />
	</td>
</tr>
<tr>
	<th>采购分类</th>
	<td><input type="hidden" name="product_categories_id" id="product_categories_id" /></td>
</tr>
<tr>
	<th>仓库</th>
	<td>
		<select name="warehouse_id">
			<option value="">请选择..</option>
			<?foreach ($warehouse as $w):?>
			<option value="<?=$w['id']?>" <?if (isset($_GET['warehouse_id']) && $_GET['warehouse_id'] == $w['id'])echo "selected='selected'"?>><?=$w['name']?></option>
			<?endforeach;?>
		</select>
	</td>
</tr>
<tr>
	<td><input type="hidden" name="is_search" value="1" /></td>
	<td><input type="submit" class="button" value="查询" /></td>
</tr>
</table>
</form></fieldset>

<?if (isset($export_url)):?>
<a href="<?=$export_url?>">右键另存为</a>
<?endif;?>
<?php $this->_endblock();?>